package com.kmb.business.controller;

import com.kmb.provider.api.LogService;
import com.kmb.provider.domain.SysLog;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping(value = "echo")
public class EchoController {

    @Reference(version = "1.0.0")
    private LogService logService;

    @GetMapping(value = "{string}")
    @PreAuthorize("hasAuthority('USER')")
    public String echo(@PathVariable String string) {
        return logService.echo(string);
    }

    @PostMapping(value = "saveLog")
    @PreAuthorize("hasAuthority('USER')")
    public void saveLog(@RequestBody SysLog sysLog) {
        logService.saveLog(sysLog);
    }

}
